home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "Module1"
- Option Explicit
-
- Sub CenterForm(F As Form)
-
- ' Center form onscreen
-
- Dim cTop As Integer
- Dim cLeft As Integer
-
- cTop = (Screen.Height - F.Height) \ 2
- cLeft = (Screen.Width - F.Width) \ 2
- If F.WindowState = 0 Then
- If cTop < 0 Then
- F.Top = 0
- Else
- F.Top = cTop
- End If
- If cLeft < 0 Then
- F.Left = 0
- Else
- F.Left = cLeft
- End If
- End If
- End Sub
-
-